package com.zhongbei.service.impl;

import com.zhongbei.mapper.MemberMapper;
import com.zhongbei.pojo.Member;
import com.zhongbei.service.MemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;  // 添加 @Service 注解
import java.util.List;

@Service // 核心修改：标记该类为 Spring 管理的 Service 层 Bean
public class MemberServiceImpl implements MemberService {

    @Autowired
    private MemberMapper memberMapper;

    @Override
    public int insertMember(Member member) {
        return memberMapper.insertMember(member);
    }

    @Override
    public int deleteMemberByMemberId(Integer memberId) {
        return memberMapper.deleteMemberByMemberId(memberId);
    }

    @Override
    public int updateMemberByMemberId(Member member) {
        return memberMapper.updateMemberByMemberId(member.getMemberId(), member);
    }

    @Override
    public List<Member> selectMemberByMemberId(Integer memberId) {
        return memberMapper.selectMemberByMemberId(memberId);
    }

    @Override
    public List<Member> selectMemberByMemberName(String memberName) {
        return memberMapper.selectMemberByMemberName(memberName);
    }
}